<?php $this->headLink()->appendStylesheet($this->dirCss.'/news.css');?>
<?php $this->headLink()->appendStylesheet($this->dirCss.'/UI_loading.css');?>
<?php echo $this->render('common/header.phtml'); ?>
<?php
	$this->title = $this->translate('Course');
	$this->headTitle ( $this->title );
?>
<div id="deleteconfirm"><?php echo $this->language->l('deleteconfirm'); ?></div>
<!-- start content-outer ........................................................................................................................START -->
<div id="content-outer">
	
	<!-- start navigation -->
		<?php echo $this->render('common/navigation.phtml');?>
	<!-- END navigation -->
	
	<!-- start content -->
	<div id="content">
	
		<!--  start page-heading -->
		<div id="page-heading">
			<h1><?php echo $this->language->l('Course List');?></h1>
		</div>
		<!-- end page-heading -->
		
		
		<div id="content-border">
			<div class="list-header">
				<span class="top-left-title"><a href="javascript:"><?php echo $this->language->l('Id') ?></a></span>
				<span class="list-header-repeat line-left rep-img"><a href="javascript:"><?php echo $this->language->l('Name') ?></a></span>
				<span class="list-header-repeat line-left"><a href="javascript:"><?php echo $this->language->l('Enabled'); ?></a></span>
				<span class="list-header-repeat line-left"><a href="javascript:"><?php echo $this->language->l('level'); ?></a></span>
				<span class="list-header-options line-left "><a href="javascript:"><?php echo $this->language->l('Create Date') ?></a></span>
				<span class="list-header-options line-left "><a href="javascript:"><?php echo $this->language->l('Modify Date') ?></a></span>
				<span class="list-header-options line-left "><a href="javascript:"><?php echo $this->language->l('Option') ?></a></span>
			</div>
			
			<div class="list-content">
				<?php foreach($this->taxonomyList as $oneTaxonomy){ ?>
					<div class="one-item">
						<span class="id_"><?php echo $oneTaxonomy['id'];?></span>
						<span class="rep-img"><?php echo @$oneTaxonomy['name'][$this->defaultLanguage]; ?></span>
						<span class="p-right9"><?php echo $oneTaxonomy['enabled']; ?></span>
						<span class="p-right9"><?php echo $oneTaxonomy['level']; ?></span>
						<span class="p-right9"><?php echo date('d/m/Y H:i:s', strtotime($oneTaxonomy['create_date'])); ?></span>
						<span class="p-right9"><?php echo ($oneTaxonomy['create_date'] != $oneTaxonomy['modify_date'])?date('d/m/Y H:i:s', strtotime($oneTaxonomy['modify_date'])):'never'; ?></span>
						<span class="list-content-options">
							<span class="options-img">
								<a href="<?php echo $this->baseUrl('/admin/taxonomy/edit/id/'.$oneTaxonomy['id']); ?>" title="<?php echo $this->language->l("Edit");?>" class="icon-1 info-tooltip"></a>
								<a href="javascript:;" title="<?php echo $this->language->l("Delete");?>" class="icon-2 info-tooltip delete"></a>
								<?php if($oneTaxonomy['enabled'] == 1){?>
									<a href="javascript:" title="<?php echo $this->language->l("Click To Disable");?>" class="icon-5 info-tooltip activate"></a>
								<?php }else{?>
									<a href="javascript:" title="<?php echo $this->language->l("Click To Enable");?>" class="icon-5-deactive info-tooltip activate"></a>
								<?php }?>
								<a href="javascript:;" title="<?php echo $this->language->l("Detail");?>" class="icon-6 info-tooltip detail"></a>
							</span>
						</span>
					</div>
				<?php }?>
				
			</div><!--  END .list-content  -->
			
			<!--  start paging..................................................... -->
			<?php try{
				echo $this->paginationControl( $this->taxonomyList, 'Sliding', 'common/pagination.phtml', array('language'=>$this->language) ); 
			}catch(Exception $ex){
				echo "Error :".$ex->getMessage();
				exit;
			}
			?>
			<!--  end paging................ -->
			
		</div><!-- END #content-border -->
		
		
	</div><!--  end content -->
	
	<div class="clear">&nbsp;</div>
</div><!--  end content-outer........................................................END -->

<?php echo $this->render('common/footer.phtml'); ?>

<?php
	$moduleName 	= Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
	$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
	$actionName 	= Zend_Controller_Front::getInstance()->getRequest()->getActionName();
	$urlName		= '/' . $moduleName . '/' . $controllerName . '/' ;
?>

<script type="text/javascript">

	//Define delete path
	var deletePath = '<?php echo $this->baseUrl().$urlName.'delete'?>';
	var activePath = '<?php echo $this->baseUrl().$urlName.'activate'?>';
	var detailPath = '<?php echo $this->baseUrl().$urlName.'detail'?>';
	var loadingUrl = <?php echo '"'.$this->baseUrl('/public/images/system/loading.gif').'"' ?>;
	
	$(document).ready(function(){
		makeBalanceDiv();
	});

	

	function makeBalanceDiv(){
		//Cân bằng div
		var widthList = new Array();
		var paddingLeft = new Array();
		var paddingRight = new Array();
		var count = 0;
		var headerLength = $('.list-header span').length;
		var curWidth = 0;
		$('.list-header span').each(function(){
			
			curWidth = parseInt($(this).css('width'));
			if(count % 2 == 0) curWidth = curWidth - 2;
			widthList[count] =  curWidth + 'px';
			
			paddingLeft[count] = $(this).css('padding-left');
			paddingRight[count] =$(this).css('padding-right');
			count = count + 1;
		});

		//console.log(widthList);
		count = 0;
		
		$('.list-content .one-item >span').each(function(){
			//console.log('ban dau, count = '+count);
			if(count != 0 && (count %  headerLength == 0)){
				count = 0;
			}
			$(this).css({'width':widthList[count], 'padding-left':paddingLeft[count], 'padding-right':paddingRight[count]});
			count = count + 1;
		});

		//Chỉnh cho option căn giữa
		var optionHeight = parseInt($('.options-img').css('height'));		
		optionHeight = (optionHeight - 24)/2;
		optionHeight = optionHeight + 'px';
		
		$('.options-img').css({'min-height':'24px', 'height':'24px', 'padding-top':optionHeight, 'padding-bottom':optionHeight});

	}
</script>